<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="com.xwtech.framework.pub.constants.CommonConstants"%>
<%@ include file="/admin/jsp/taglibs.jsp"%>
<html>
	<head>
		<%@ include file="/admin/jsp/header.jsp"%>
		<%@ include file="/framework/jsp/tablesorter.jsp"%>
	</head>
	<body onload="init();">
		<table width="98%" border="0" align="center" cellpadding="3" cellspacing="0">
			<tr>
				<td class="page-title">
					<img src="../images/page_title.gif" alt="title" width="17" height="12" align="absmiddle">
					&nbsp;&nbsp; 系统管理 » 号段管理 

				</td>
			</tr>
		</table>
		<br>
		<form id="mainForm" action="/admin/jsp/segmentMgr.do?method=querySegment" method="post">
			<input type="hidden" name="pageNo" id="pageNo" value="${page.pageNo}" />
			<input type="hidden" name="pageSize" id="pageSize" value="${page.pageSize}" />
			<input type="hidden" name="orderBy" id="orderBy" value="${page.orderBy}" />
			<input type="hidden" name="order" id="order" value="${page.order}" />
			<fieldset style="width: 98%; padding: 10px">
				<legend>
					号段查询
				</legend>
				<table width="60%" height="50" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td>
							号段：






							
							
							<input type="text" name="filter_LIKE_segmentCode" id="operTimeS" value="${param['filter_LIKE_segmentCode']}" size="8">
						</td>
						<td>
							地区：






							
							
							<select name="filter_EQ_regionId" id="regionId">
								<option value="">--请选择--</option>
								<c:forEach var="region" items="${regionList}">
									<option value="<c:out value='${region.regionId}'/>"><c:out value="${region.regionName}"/></option>
								</c:forEach>
							</select>
						</td>
						<td>
							运营商：
							
							
							<select name="filter_EQ_optId" id="optId">
								<option value="">--请选择--</option>
								<c:forEach var="opt" items="${optList}">
									<option value="<c:out value='${opt.optCode}'/>"><c:out value="${opt.optName}"/></option>
								</c:forEach>
							</select>
						</td>
						<td>
							<input type="submit" class="short-button" value="查  询" onclick="search()"/>
						</td>
					</tr>
				</table>
			</fieldset>	
		<br>
			<table width="90%" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td>
						<input type="button" class="short-button" value="新  增" onclick="javascript:window.location='/admin/jsp/segmentMgr.do?method=addSegment'" />
						&nbsp;&nbsp;&nbsp;
						<input type="button" class="short-button" value="删除所选" onclick="delChecked()" />
						&nbsp;&nbsp;&nbsp;
						<input type="button" class="short-button" value="批量载入" onclick="javascript:window.location='/admin/jsp/sys_mgr/segment_mgr/segment_batchLoader.jsp'" />
					</td>
				</tr>
			</table>
			<table id="tableList" cellspacing="1" class="tablesorter" width="90%">
				<thead>
					<tr align="center">		
						<th class="{sorter: false}" width="4%">
							<input class="checkbox" type="checkbox" name="operSegmentId" onclick="javascript:selectAll('segmentId',this.checked)">
						</th>				
						<th width="80">
							序号
						</th>	
						<th>
							<a href="javascript:sort('segmentCode','asc')">手机号段</a>
						</th>
						<th>
							号段地区
						</th>	
						<th>
							运营商


						</th>				
						<th>
							操作
						</th>
					</tr>
				</thead>
				<tbody>
					<c:if test="${page.totalCount != '0'}">
						<c:forEach var="segment" items="${page.result}" varStatus="status">
							<tr align="center">	
								<td>
									<input class="checkbox" type="checkbox" name="segmentId" value="<c:out value='${segment.segmentId}' />" />
								</td>							
								<td>
									<c:out value="${status.index+1}"/>
								</td>
								<td>
									<c:out value='${segment.segmentCode}'></c:out>
								</td>
								<td>
									<c:out value="${segment.regionName}"></c:out> 
								</td>			
								<td>
									<c:choose>
										<c:when test="${segment.optId==''}">--</c:when>
										<c:when test="${segment.optId!=''}">
											<c:out value="${segment.optName}"></c:out>
										</c:when>
									</c:choose>
								</td>	
								<td>
									<img src="/admin/images/delp.gif" title="删除" style="cursor: pointer" onclick="delSegment(<c:out value='${segment.segmentId}' />)">
								</td>							
							</tr>
						</c:forEach>
					</c:if>
					<c:if test="${page.totalCount == '0'}">
						<tr align="center">
							<td colspan="7" align="left">
								暂无符合条件的记录






							</td>
						</tr>
					</c:if>
				</tbody>
			</table>
			<div>
				<jsp:include page="/framework/jsp/pager.jsp" flush="true" />
			</div>
		</form>
	</body>
	<script type="text/javascript">
	
	function init()
	{
	//保留下拉框查询条件

		var regionId = "${param['filter_EQ_regionId']}";
		document.getElementById("regionId").value = regionId;
		
		var optId = "${param['filter_EQ_optId']}";
		document.getElementById("optId").value = optId;
	}
	
	function search(){
		$("#order").val("desc");
		$("#orderBy").val("segmentId");
		$("#pageNo").val("1");
		$("#pageSize").val("5");
		$("#mainForm").submit();
	}
	
	
	//编辑
	//function editSegment(segmentId){
	//	window.location="/admin/jsp/segmentMgr.do?method=editSegment&segmentId="+segmentId;
	//}
	
	
	//删除
	function delSegment(segmentId){
		if(confirm('确定删除该号段？'))
			window.location="/admin/jsp/segmentMgr.do?method=delSegment&segmentId="+segmentId;
	}
	//批量删除
	function delChecked(){
		if(getCheckboxCheckedValue("segmentId") != ""){
			if(confirm("确定删除所选号段？")){
				//$("#deleteForm").submit();
				document.getElementById("mainForm").action = "/admin/jsp/segmentMgr.do?method=delSegments";
				document.getElementById("mainForm").submit();
				}
			}else{
				alert("请选择需要删除的号段！");
			}
	}
	
	</script>
</html>